package map;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo2 {
    public static void main(String[] args) {
        Map<String, Integer> map = new HashMap<>();
        map.put("语文",99);
        map.put("数学",91);
        map.put("英语",89);
        map.put("物理",69);
        map.put("化学",95);
        System.out.println(map);
        Set<String> keySet = map.keySet();
        for (String key :
                keySet) {
            System.out.println(key + ": " + map.get(key));
        }
        Set<Map.Entry<String, Integer>> entrySet = map.entrySet();
        for (Map.Entry e :
                entrySet) {
            System.out.println(e.getKey() + ": " + e.getValue());
        }
        Collection<Integer> values = map.values();
        for (Integer i :
                values) {
            System.out.println(i);
        }

    }
}
